TOOL.Category = 'Carbon Systems'
TOOL.Name = 'Generators'
TOOL.Command = nil
TOOL.ConfigName = ''
if (CLIENT and GetConVarNumber("RD_UseLSTab") == 1) then TOOL.Tab = "ESN Customs" end

TOOL.ClientConVar['type'] = 'carbon_combiner'
TOOL.ClientConVar['model'] = 'models/chipstiks_ls3_models/CO2Comp/co2comp.mdl'

cleanup.Register('carbonsystem')

if ( CLIENT ) then
	language.Add( 'Tool_carbonsystems_name', 'Carbon Systems Generators' )
	language.Add( 'Tool_carbonsystems_desc', 'Create Generators attached to any surface.' )
	language.Add( 'Tool_carbonsystems_0', 'Left-Click: Spawn a Device.  Right-Click: Repair Device.' )

	language.Add( 'Undone_carbonsystems', 'Generator Undone' )
	language.Add( 'Cleanup_carbonsystems', 'LS: Generators' )
	language.Add( 'Cleaned_carbonsystems', 'Cleaned up all Carbon Systems Generators' )
	language.Add( 'SBoxLimit_carbonsystems', 'Maximum Carbon Systems Generators Reached' )
end

if not ( RES_DISTRIB == 2 ) then Error("Please Install Resource Distribution 2 Addon.'" ) return end

local carbonsystems = {}
if (SERVER) then
	
	carbonsystems.carbon_combiner = function( ply, ent, system_type, system_class, model )
		local maxhealth = 600
		local mass = 500
		RD_AddResource(ent, "energy", 0)
		RD_AddResource(ent, "Carbon", 0)
		RD_AddResource(ent, "CO2", 0)
		RD_AddResource(ent, "Oxygen", 0)
		LS_RegisterEnt(ent, "Generator")
		return {}, maxhealth, mass
	end	

	carbonsystems.co2_seperator = function( ply, ent, system_type, system_class, model )
		local maxhealth = 600
		local mass = 500
		RD_AddResource(ent, "energy", 0)
		RD_AddResource(ent, "Carbon", 0)
		RD_AddResource(ent, "CO2", 0)
		RD_AddResource(ent, "Oxygen", 0)
		LS_RegisterEnt(ent, "Generator")
		return {}, maxhealth, mass
	end

	carbonsystems.oxy_air = function( ply, ent, system_type, system_class, model )
		local maxhealth = 600
		local mass = 500
		RD_AddResource(ent, "energy", 0)
		RD_AddResource(ent, "Oxygen", 0)
		RD_AddResource(ent, "air", 0)
		LS_RegisterEnt(ent, "Generator")
		return {}, maxhealth, mass
	end
	
	

end

local carbonsystem_models = {
	
	{ 'Carbon Combiner', 'models/chipstiks_ls3_models/CO2Comp/co2comp.mdl', 'carbon_combiner' },

	{ 'Carbon Seperator', 'models/chipstiks_ls3_models/CO2Comp/co2comp.mdl', 'co2_seperator' },

	{ 'Oxygen to Air', 'models/ce_ls3additional/compressor/compressor_large.mdl', 'oxy_air' },

}

RD2_ToolRegister( TOOL, carbonsystem_models, nil, "carbonsystems", 30, carbonsystems )
